/**
 * creater:han.wen@dhc.com.cn
 * create time:2016-06-01 13:46:27
 * describe:过滤器
 */
APP.controller('FilterExampleController', ['$scope', 'FilterExampleService',
  function ($scope, FilterExampleService) {

    /***变量声明***/
    $scope.time = undefined;
    $scope.currency = undefined;
    $scope.telephone = undefined;
    $scope.letter = undefined;
    $scope.number = undefined;
    $scope.data = undefined;
    $scope.jsonData = undefined;

    /**
     * 初始化函数
     */
    $scope.init = function () {
      $scope.time = new Date();
      $scope.currency = 100000000;
      $scope.telephone = 18812345678;
      $scope.letter = 'ABC456';
      $scope.number = 72.86662;
      $scope.data = [
        {
          name: 'wenhan',
          age: 27
        },
        {
          name: 'zhangjunhui',
          age: 24
        }, {
          name: 'zhuchuanpeng',
          age: 29
        }
      ];
      $scope.jsonData = {
        'name':'wenhan',
        'age':'27'
      };
    };
    /*
     $scope.init();//如果页面缓存则用此方法初始化
     */
    $scope.$on('$ionicView.beforeEnter', function () {
      $scope.init();
    });
  }
]);

/**
 * creater:han.wen@dhc.com.cn
 * create time:2016-06-01 13:46:27
 * describe:过滤器
 */
APP.service('FilterExampleService', ['$http', 'UrlService', function ($http, UrlService) {
  /**
   * 登录方法
   * @param username  登录用户名
   * @param password  登录密码
   */
  this.doLogin = function (username, password) {
    var param = {
      username: username,
      password: password
    };
    $http.post(UrlService.get('LOGIN'), param);
  }

}]);
